
import ctp_md_api as md
import ctp_td_api as td
import time

def OnTick(UpdateTime,InstrumentID,LastPrice):
    print('行情推送:'+ UpdateTime + ',品种:'+ InstrumentID + ',最新价格:'  ,LastPrice)
    #ctp_trade = td.zyc_ctptd
    #ctp_trade.qryPosition()
    i = 0

    time.sleep(1)

    if len(position) == 0:
        ctp_trade.buy('rb1812',4238,1,'买入','开仓')

def GetPosition(data):
    self.position = data


